﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Counter : Condition
{
    public int target;
    public int value;
    public bool clearOnDisable;

    public void Add()
    {
        Add(1);
    }

    public void Add(int value)
    {
        this.value += value;
        if (this.value >= target)
        {
            this.value = 0;
            ToJump = true;
        }
    }

    public void Clear()
    {
        value = 0;
    }

    private void OnDisable()
    {
        if (clearOnDisable)
        {
            value = 0;
        }
    }
}
